package cn.lefull.mapper;

import cn.lefull.entity.Apartment;
import cn.lefull.entity.ApartmentSubject;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @description:
 * @auther: qijiang
 * @date: 2018/12/25 15:19
 */

public interface ApartmentSubjectMapper {

    @Insert("<script>" +
            "insert into apartment_subject_copy\n" +
            "\t\t(\tid,\n" +
            "\t\t\tapartment_subject_id,\n" +
            "\t\t\tsubject_info_id,\n" +
            "\t\t\tsubject_name,\n" +
            "\t\t\trevenue_type,\n" +
            "\t\t\tapartment_id,\n" +
            "\t\t\toperator_id,\n" +
            "\t\t\torganization_id,\n" +
            "\t\t\tcreate_time,\n" +
            "\t\t\tdelete_status,\n" +
            "\t\t\tupdate_time,\n" +
            "\t\t\tdelete_time\n" +
            "\t\t)\n" +
            "\t\tvalues\n" +
            "\t\t<foreach collection=\"list\" item=\"o\"  index=\"index\" separator=\",\" >\n" +
            "\t\t(\n" +
            "\t\t\t#{o.id},\n" +
            "\t\t\t#{o.apartmentSubjectId},\n" +
            "\t\t\t#{o.subjectInfoId},\n" +
            "\t\t\t#{o.subjectName},\n" +
            "\t\t\t#{o.revenueType},\n" +
            "\t\t\t#{o.apartmentId},\n" +
            "\t\t\t#{o.operatorId},\n" +
            "\t\t\t#{o.organizationId},\n" +
            "\t\t\tunix_timestamp(now()),\n" +
            "\t\t\t#{o.deleteStatus},\n" +
            "\t\t\t#{o.updateTime},\n" +
            "\t\t\t#{o.deleteTime}\n" +
            "\t\t)\n" +
            "\t\t</foreach>" +
            "</script>")
    void insertList(@Param("list") List<ApartmentSubject> list);
}
